how to solve variation problems